import  java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        int[] arr = new int[count];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
        int sum = 0;
        int sum1 = 0;
        int count1 = 0;
        int left = 0, right = 1;
        int left2 = 0, right2 = 0;
        int left1 = 0, right1 = 0;
        while (left < right && right < arr.length) {
            if (arr[left] <= arr[right]) {
                left1 = left;
                right1 = right;
                while (left1 < right1 && right1 < arr.length && arr[left1] <= arr[right1]) {
                    right1++;
                    left1++;
                    sum1++;
                }//不满足跳出循环
            }
            if (arr[left] >= arr[right]) {
                left2 = left;
                right2 = right;
                while (left2 < right2 && right2 < arr.length && arr[left2] >= arr[right2]) {
                    right2++;
                    left2++;
                    sum++;
                }
            }
            if (sum1 > sum) {
                sum1 = 0;
                sum = 0;
                left = right1;
                right = right1 + 1;
            } else {
                sum = 0;
                sum1 = 0;
                left = right2;
                right = right2 + 1;
            }
            count1++;
        }
        System.out.println(count1);
    }
}